<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title></title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
		<script type="text/javascript">
		<!--
			var ligerTable = null;
			$(function(){
				
				ligerTable = $('#table').ligerGrid({
					width:'98%',
					enabledSort:false,
					pageSizeOptions:[5,10,20,50,100,200],
					height:'auto',
					alternatingRow:true,
					url:'${base}/${route}/getList',
					delayLoad:false,
					columns:[
						{display:'ID',name:'id',id:'id',align:'center'},
						{display:'城市名称',name:'city',id:'city',align:'center'},
						{display:'城市编码',name:'code',id:'code',align:'center'},
						{display:'首字母',name:'letter',id:'letter',align:'center'},
                        {
							display:'操作时间',
							name:'datetime',
							id:'datetime',
							align:'center',
							minWidth:150,
							render:function(row){
						 		if(row.datetime > 0){
						 			return formatDate(row.datetime * 1000);
						 		}
						 		return '-';
							}
						},
						{
							display:'是否启用',
							name:'enabled',
							id:'enabled',
							align:'center',
							render:function(row){
								var enabled = row.enabled;
						 		if(enabled){
						 			return '是';
						 		}
						 		return '否';
							}
						},
						{
							display:'操 作',
							align:'center',
							render:function(row){
								var dictId = row.id;
								return [ 
								'<a class="edit" href="javascript:void(0)" onclick="editItem('+dictId+')"  title="编辑">',
					                '<i class="fa fa-edit"></i>',
					            '</a>',
								'<a class="edit" href="javascript:void(0)" onclick="removeItem('+dictId+')"  title="删除">',
					                '<i class="fa fa-remove"></i>',
					            '</a>'
					            ].join('');
								
							}
						}
					]
				});

				function reload(){
                    if(ligerTable){
                        var city = $('#txtCity').val();
                        ligerTable.setParm('city',city);
                        ligerTable.reload();
                    }
                }

                $('#btnSearch').click(function(){
                    reload();
                });
			});

		    function editItem(dictId){
	        	var url='${base}/${route}/edit/'+dictId;
	            changePage(url);
		    }
		    function removeItem(dictId){
		    	layer.confirm('确定要删除吗？',function(){
	    			$.ajax({
	            		url:'${base}/${route}/remove/'+dictId,
	            		type:'POST',
	            		data:{},
	            		dataType:'json',
	            		success:function(rst){
	            			layer.msg(rst.message);
	            			if(rst.status=='OK' && ligerTable != null ){
	            				ligerTable.reload();
	            			}
	            		}
	            	});	
	    		});
		    }
		//-->
		</script>
	</head>
	<body class="$configs["skinName"]">
		<#include "common/breadcrumb.ftl">
		<div class="widget-box">
			<div class="widget-header">
				<h5 class="lighter">
					<i class="icon-table"></i>
					城际通开通城市列表
				</h5>
			</div>
			<div class="widget-body">
                <div class="widget-main">
                    <div class="row">
                        <div class="col-sm-5">
                            <div class="input-group">
                                <input id="txtCity" type="text" class="form-control search-query" placeholder="请输入城市名称" />
                                <span class="input-group-btn">
                                    <button id="btnSearch" type="button" class="btn btn-primary btn-sm">
                                        查询
                                        <i class="icon-search icon-on-right bigger-110"></i>
                                    </button>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
			<div class="widget-body">
				<div id="table"><div>
			</div>
		</div>
	</body>
</html>